﻿// --------------------------------
// <copyright file="MethodSignatureTest.cs" company="TRONSoft">
//     Copyright (c) TRONSoft.
// </copyright>
// <license>
//   This source code is subject to terms and conditions of the Microsoft
//   Public License. A copy of the license can be found in the License.html
//   file at the root of this distribution. If you cannot locate the
//   Microsoft Public License, please send an email to dlr@microsoft.com.
//   By using this source code in any fashion, you are agreeing to be bound 
//   by the terms of the Microsoft Public License. You must not remove this
//   notice, or any other, from this software.
// </license>
// <author>Tron</author>
// ---------------------------------

using System;
using System.CodeDom;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Tronsoft.Actucal.CalculationEngineCreator.Test
{    
    /// <summary>
    ///This is a test class for MethodSignatureTest and is intended
    ///to contain all MethodSignatureTest Unit Tests
    ///</summary>
    [TestClass()]
    public class MethodSignatureTest
    {
        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        /// <summary>
        ///A test for ReturnValue
        ///</summary>
        [TestMethod()]
        public void ReturnValue_Test()
        {
            MethodSignature target = new MethodSignature(); 
            Type expected = typeof(string); 
            Type actual;
            target.ReturnValue = expected;
            actual = target.ReturnValue;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Parameters
        ///</summary>
        [TestMethod()]
        public void Parameters_Test()
        {
            MethodSignature target = new MethodSignature();
            target.Parameters.Add(new MethodParameter("p1", typeof(string)));
            Assert.AreEqual(1, target.Parameters.Count);
        }

        /// <summary>
        ///A test for AddParameter
        ///</summary>
        [TestMethod()]
        public void AddParameter_Name_And_Direction_And_Type_Test()
        {
            MethodSignature target = new MethodSignature(); 
            string name = "p1"; 
            FieldDirection direction = FieldDirection.Ref; 
            Type type = typeof(int); 
            MethodParameter expected = new MethodParameter(name, direction, type);
            MethodParameter actual = target.AddParameter(name, direction, type);

            Assert.IsFalse(expected.Name.Contains(" "));
            Assert.AreEqual(expected.Name, actual.Name);
            Assert.AreEqual(expected.Direction, actual.Direction);
            Assert.AreEqual(expected.Type, actual.Type);
        }

        /// <summary>
        ///A test for AddParameter
        ///</summary>
        [TestMethod()]
        public void AddParameter_Name_And_And_Type_Test()
        {
            MethodSignature target = new MethodSignature(); 
            string name = "p1";
            Type type = typeof(int); 
            MethodParameter expected = new MethodParameter(name, type); 
            MethodParameter actual;
            actual = target.AddParameter(name, type);

            Assert.IsFalse(expected.Name.Contains(" "));
            Assert.AreEqual(expected.Name, actual.Name);
            Assert.AreEqual(expected.Direction, actual.Direction);
            Assert.AreEqual(expected.Type, actual.Type);
        }

        /// <summary>
        ///A test for MethodSignature Constructor
        ///</summary>
        [TestMethod()]
        public void MethodSignatureConstructorTest()
        {
            MethodSignature target = new MethodSignature();
        }
    }
}
